package me.aartikov.alligator.animations;


import ohos.aafwk.ability.Ability;
import ohos.aafwk.ability.fraction.Fraction;
import ohos.aafwk.ability.fraction.FractionScheduler;
import ohos.aafwk.content.Intent;
import ohos.aafwk.content.Operation;

/**
 * Animation that played during a transition from one screen to another.
 */
public interface TransitionAnimation {
    public final static int LEFT = -1;
    public final static int RIRHT = -2;
    public final static int STAY = 0;
    TransitionAnimation DEFAULT = null;
//    TransitionAnimation DEFAULT = new DummyTransitionAnimation();

    int getEnterAnimal();

    int getExitAnimal();

    /**
     * Is called before starting of an activity. Used to pass an options bundle to a started activity.
     *
     * @param activity current activity
     * @return options bundle for activity starting. Can be {@code null} if there are no options needed.
     */

    Operation getActivityOptionsBundle(Ability activity);

    /**
     * Is called before finishing of an activity. Checks if there is need to delay an activity finish.
     * <p>
     * An activity will finish using {@code supportFinishAfterTransition} if this method returns {@code true}, otherwise - using {@code finish}.
     *
     * @return true if an activity finish should be delayed
     */
    boolean needDelayActivityFinish();

    /**
     * Is called before starting of an activity.
     *
     * @param currentActivity activity that will start another activity
     * @param intent          intent that will be used to start an activity
     */
    void applyBeforeActivityStarted(Ability currentActivity, Intent intent);

    /**
     * Is called after starting of an activity.
     *
     * @param currentActivity activity that started another activity
     */
    void applyAfterActivityStarted(Ability currentActivity);

    /**
     * Is called before finishing of an activity.
     *
     * @param activity that will finish
     */
    void applyBeforeActivityFinished(Ability activity);

    /**
     * Is called after finishing of an activity.
     *
     * @param activity finished activity
     */
    void applyAfterActivityFinished(Ability activity);

    /**
     * Is called before a fragment transaction executed.
     *
     * @param transaction      fragment transaction
     * @param enteringFragment fragment that will be added/attached during the transaction
     * @param exitingFragment  fragment that will be removed/detached  during the transaction
     */
    void applyBeforeFragmentTransactionExecuted(FractionScheduler transaction, Fraction enteringFragment, Fraction exitingFragment);

    /**
     * Is called after a fragment transaction executed.
     *
     * @param enteringFragment fragment that will be added/attached during the transaction
     * @param exitingFragment  fragment that will be removed/detached  during the transaction
     */
    void applyAfterFragmentTransactionExecuted(Fraction enteringFragment, Fraction exitingFragment);
}
